home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / include / gnt / gnttextview.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-05-04  |  2.9 KB  |  89 lines

  1. #ifndef GNT_TEXT_VIEW_H
  2. #define GNT_TEXT_VIEW_H
  3.  
  4. #include "gntwidget.h"
  5. #include "gnt.h"
  6. #include "gntcolors.h"
  7. #include "gntkeys.h"
  8.  
  9. #define GNT_TYPE_TEXT_VIEW                (gnt_text_view_get_gtype())
  10. #define GNT_TEXT_VIEW(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_TEXT_VIEW, GntTextView))
  11. #define GNT_TEXT_VIEW_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_TEXT_VIEW, GntTextViewClass))
  12. #define GNT_IS_TEXT_VIEW(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_TEXT_VIEW))
  13. #define GNT_IS_TEXT_VIEW_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_TEXT_VIEW))
  14. #define GNT_TEXT_VIEW_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_TEXT_VIEW, GntTextViewClass))
  15.  
  16. #define GNT_TEXT_VIEW_FLAGS(obj)                (GNT_TEXT_VIEW(obj)->priv.flags)
  17. #define GNT_TEXT_VIEW_SET_FLAGS(obj, flags)        (GNT_TEXT_VIEW_FLAGS(obj) |= flags)
  18. #define GNT_TEXT_VIEW_UNSET_FLAGS(obj, flags)    (GNT_TEXT_VIEW_FLAGS(obj) &= ~(flags))
  19.  
  20. typedef struct _GntTextView            GntTextView;
  21. typedef struct _GntTextViewPriv        GntTextViewPriv;
  22. typedef struct _GntTextViewClass        GntTextViewClass;
  23.  
  24. struct _GntTextView
  25. {
  26.     GntWidget parent;
  27.  
  28.     GString *string;
  29.     GList *list;        /* List of GntTextLine */
  30.  
  31.     GList *tags;       /* A list of tags */
  32. };
  33.  
  34. typedef enum
  35. {
  36.     GNT_TEXT_FLAG_NORMAL      = 0,
  37.     GNT_TEXT_FLAG_BOLD        = 1 << 0,
  38.     GNT_TEXT_FLAG_UNDERLINE   = 1 << 1,
  39.     GNT_TEXT_FLAG_BLINK       = 1 << 2,
  40.     GNT_TEXT_FLAG_DIM         = 1 << 3,
  41.     GNT_TEXT_FLAG_HIGHLIGHT   = 1 << 4,
  42. } GntTextFormatFlags;
  43.  
  44. struct _GntTextViewClass
  45. {
  46.     GntWidgetClass parent;
  47.  
  48.     void (*gnt_reserved1)(void);
  49.     void (*gnt_reserved2)(void);
  50.     void (*gnt_reserved3)(void);
  51.     void (*gnt_reserved4)(void);
  52. };
  53.  
  54. G_BEGIN_DECLS
  55.  
  56. GType gnt_text_view_get_gtype(void);
  57.  
  58. /* XXX: For now, don't set a textview to have any border.
  59.  *      If you want borders real bad, put it in a box. */
  60. GntWidget *gnt_text_view_new(void);
  61.  
  62. /* scroll > 0 means scroll up, < 0 means scroll down, == 0 means scroll to the end */
  63. void gnt_text_view_scroll(GntTextView *view, int scroll);
  64.  
  65. void gnt_text_view_append_text_with_flags(GntTextView *view, const char *text, GntTextFormatFlags flags);
  66.  
  67. void gnt_text_view_append_text_with_tag(GntTextView *view, const char *text, GntTextFormatFlags flags, const char *tag);
  68.  
  69. /* Move the cursor to the beginning of the next line and resets text-attributes.
  70.  * It first completes the current line with the current text-attributes. */
  71. void gnt_text_view_next_line(GntTextView *view);
  72.  
  73. chtype gnt_text_format_flag_to_chtype(GntTextFormatFlags flags);
  74.  
  75. void gnt_text_view_clear(GntTextView *view);
  76.  
  77. int gnt_text_view_get_lines_below(GntTextView *view);
  78.  
  79. int gnt_text_view_get_lines_above(GntTextView *view);
  80.  
  81. /* If text is NULL, then the tag is removed. */
  82. int gnt_text_view_tag_change(GntTextView *view, const char *name, const char *text, gboolean all);
  83.  
  84. void gnt_text_view_attach_scroll_widget(GntTextView *view, GntWidget *widget);
  85.  
  86. G_END_DECLS
  87.  
  88. #endif /* GNT_TEXT_VIEW_H */
  89.